<template>
  <div class="hello">
    <div style="text-align: center">{{this.msg}}</div>
    <button @click="get()">get请求</button>
    <button @click="post()">post请求</button>
    <!-- <el-pagination
      background
      @prev-click="prePage"
      @next-click="nextPage"
      @size-change="handleSizeChange"
      @current-change="handleCurrentChange"
      :page-sizes="[10, 25, 50]"
      :page-size="10"
      style="float:right;margin:10px 0"
      layout="total,sizes,prev, pager, next"
      :total="41"
      >
  </el-pagination> -->
  <el-button style="padding:8px;margin-bottom:10px" type="primary" icon="el-icon-edit-outline" @click="dialogFormVisible = true" :class="this.multipleSelection.length==1?'undisabled':'disabled'"  >修改</el-button>
  <!-- <el-button type="text" @click="dialogFormVisible = true">打开嵌套表单的 Dialog</el-button> -->
  <el-dialog title="收货地址" :visible.sync="dialogFormVisible">
    <el-form :model="form">
      <el-form-item label="活动名称" :label-width="formLabelWidth">
        <el-input v-model="form.name" autocomplete="off"></el-input>
      </el-form-item>
      <el-form-item label="活动区域" :label-width="formLabelWidth">
        <el-select v-model="form.region" placeholder="请选择活动区域">
          <el-option label="区域一" value="shanghai"></el-option>
          <el-option label="区域二" value="beijing"></el-option>
        </el-select>
      </el-form-item>
    </el-form>
    <div slot="footer" class="dialog-footer">
      <el-button @click="dialogFormVisible = false">取 消</el-button>
      <el-button type="primary" @click="closeBtn()">确 定</el-button>
    </div>
  </el-dialog>
  </div>
</template>

<script>
export default {
  name: 'HelloWorld',
  data () {
    return {
      msg: 'Welcome to Your Vue.js App',
      multipleSelection:[1],
      dialogFormVisible: false,
      form: {
        name: '',
        region: '',
      },
      formLabelWidth: '100px'
    }
  },
  mounted(){
    $(function(){
        $(".disabled").attr("disabled","disabled");
        $(".undisabled").removeAttr("disabled");;
    })
  },
  methods:{
    closeBtn(){
      this.dialogFormVisible = false
      console.log(this.form)
    },
    handleSizeChange(val) {
      console.log(`每页 ${val} 条`);
    },
    handleCurrentChange(val) {
      console.log(`当前页: ${val}`);
    },
    get(){
      //get请求
      this.$axios.get(this.Ce_Host_GET,{
        params: {//get请求参数
          format:'json',
          calback:'',
          from:'webapp_music',
          method:'baidu.ting.billboard.billList',
          type:'1',
          size:'10',
          offset:'0'
        }
      }).then((res) =>{          //这里使用了ES6的语法
          console.log(res)       //请求成功返回的数据
      }).catch((error) =>{
          console.log(error)       //请求失败返回的数据
      })
    },
    post(){
      //post请求
      let data = {"key":"1234"};//post请求参数
      this.$axios.post(this.Ce_Host_POST,data)
      .then(res=>{
          console.log(res);            
      })
      .catch((error) =>{
          console.log(error)       //请求失败返回的数据
      })
    }
  }
}
</script>

<!-- Add "scoped" attribute to limit CSS to this component only -->
<style scoped>
</style>
